using System;
using System.Data;
using System.Configuration;
using System.Web;
using PccCommonForC;
using db_ShowRoom;


namespace bs_ShowRoom
{
    public class bs_user :PccCommonForC.BsBaseObject
    {
        string mcon = "";
        public bs_user(string connect)
        {
            mcon = connect;
        }
        private const string COMPONENTNAME = "bs_ShowRoom.bs_user.";


        #region "Function"

        public override string DoReturnStr(string strCommand, string strXML, string strOther)
        {
            string strReturn = "";
            string strStartTime = DateTime.Now.ToString();
            switch (PccToolFunc.Upper(strCommand))
            {
                case "INSUPDUSER":
                    strReturn = bs_InUpdUser(strXML);
                    break;
                case "INSUPDCUSTOMER":
                    strReturn = bs_InUpdCustomer(strXML);
                    break;
                case "INSUPDORDER":
                    strReturn = bs_InUpdOrder(strXML);
                    break;
               case "INSUPDGIFTUSER":
                    strReturn = bs_InsUpd_Gift_User(strXML);
                    break;
               case "TESTUSER_EMAIL":
                    strReturn = bs_TestUserEmail(strXML);
                    break;
               case "UPDATEPASS":
                    strReturn = bs_UpdatePass(strXML);
                    break;
               case "UPDEMAILQC":
                    strReturn = bs_InsUpdEmailQC(strXML);
                    break;
                    
            }
            return strReturn;
        }



        public override DataSet DoReturnDataSet(string strCommand, string strXML, string strOther)
        {
            DataSet dsReturn = null;
            string strReturn = "";
            string strStartTime = DateTime.Now.ToString();

            switch (PccToolFunc.Upper(strCommand))
            {
                case "GETUSERLOGIN":
                    dsReturn = bs_GetUserLogin(strXML);
                    break;
                case "GETCUSTOMERID":
                    dsReturn = bs_GetCustomerID(strXML);
                    break;
                case "GETTTDH":
                    dsReturn = bs_GetThongTinDH(strXML);
                    break;
                case "GETDDLCITY":
                    dsReturn = bs_GetDllCity(strXML);
                    break;

                 case "GETLISTUSER":
                     dsReturn = bs_GetListUser(strXML);
                    break;
                 case "GETLISTUSERBYSEARCH":
                    dsReturn = bs_GetListUserBySearch(strXML);
                    break;
                  case "GETPOINT":
                    dsReturn = bs_GetPoint(strXML);
                    break;
                 case "GETGIFTSUSER":
                    dsReturn = bs_GetGiftsByUser(strXML);
                    break;  
                 case "GETUSERPASS":
                    dsReturn = bs_GetUserPass(strXML);
                    break;
                 case "GETUSER":
                    dsReturn = bs_GetUser(strXML);
                    break;  
                case "GETDLLDIS":
                    dsReturn = bs_GetddlDistris(strXML);
                    break;  
                case "GETUSERLOGINSESS":
                    dsReturn = bs_GetUserLoginSess(strXML);
                    break;
                    
            }

            if (dsReturn != null)
                strReturn = "DsFirstTableName---" + dsReturn.Tables[0].TableName;

            return dsReturn;
        }
        #endregion

        #region "InUpd Function"
        private string bs_InUpdUser(string strXML)
        {
            string strReturn;
            db_user mydb = new db_user(mcon);
            strReturn = mydb.db_InsUpd_User(strXML);
            return strReturn;
        }
        private string bs_InUpdCustomer(string strXML)
        {
            string strReturn;
            db_user mydb = new db_user(mcon);
            strReturn = mydb.db_InsUpd_Customer(strXML);
            return strReturn;
        }
        private string bs_InUpdOrder(string strXML)
        {
            string strReturn;
            db_user mydb = new db_user(mcon);
            strReturn = mydb.db_InsUpd_Order(strXML);
            return strReturn;
        }
        private string bs_InsUpd_Gift_User(string strXML)
        {
            string strReturn;
            db_user mydb = new db_user(mcon);
            strReturn = mydb.db_InsUpd_Gift_User(strXML);
            return strReturn;
        }
        private string bs_TestUserEmail(string strXML)
        {
            string strReturn;
            db_user mydb = new db_user(mcon);
            strReturn = mydb.db_Test_User_Email(strXML);
            return strReturn;
        }

        private string bs_UpdatePass(string strXML)
        {
            string strReturn;
            db_user mydb = new db_user(mcon);
            strReturn = mydb.db_UpdPass(strXML);
            return strReturn;
        }
        private string bs_InsUpdEmailQC(string strXML)
        {
            string strReturn;
            db_user mydb = new db_user(mcon);
            strReturn = mydb.db_InsUpdEmailQC(strXML);
            return strReturn;
        }
        
        #endregion
        #region Get Function
        private DataSet bs_GetUserLogin(string strXML)
        {
            db_user mydb = new db_user(mcon);
            DataSet ds = mydb.db_GetUserLogin(strXML);
            return ds;
        }
        private DataSet bs_GetCustomerID(string strXML)
        {
            db_user mydb = new db_user(mcon);
            DataSet ds = mydb.db_GetCustomerID(strXML);
            return ds;
        }
        private DataSet bs_GetThongTinDH(string strXML)
        {
            db_user mydb = new db_user(mcon);
            DataSet ds = mydb.db_GetThongTinDH(strXML);
            return ds;
        }
        private DataSet bs_GetDllCity(string strXML)
        {
            db_user mydb = new db_user(mcon);
            DataSet ds = mydb.db_GetDllCity(strXML);
            return ds;
        }
        private DataSet bs_GetListUser(string strXML)
        {
            db_user mydb = new db_user(mcon);
            DataSet ds = mydb.db_GetListUser(strXML);
            return ds;
        }
        private DataSet bs_GetListUserBySearch(string strXML)
        {
            db_user mydb = new db_user(mcon);
            DataSet ds = mydb.db_GetListUserBySearch(strXML);
            return ds;
        }
        
        private DataSet bs_GetPoint(string strXML)
        {
            db_user mydb = new db_user(mcon);
            DataSet ds = mydb.db_GetPoint(strXML);
            return ds;
        }
        private DataSet bs_GetGiftsByUser(string strXML)
        {
            db_user mydb = new db_user(mcon);
            DataSet ds = mydb.db_GetGiftsByUser(strXML);
            return ds;
        }
        private DataSet bs_GetUserPass(string strXML)
        {
            db_user mydb = new db_user(mcon);
            DataSet ds = mydb.db_GetUserPass(strXML);
            return ds;
        }
        private DataSet bs_GetUser(string strXML)
        {
            db_user mydb = new db_user(mcon);
            DataSet ds = mydb.db_GetUser(strXML);
            return ds;
        }
        private DataSet bs_GetddlDistris(string strXML)
        {
            db_user mydb = new db_user(mcon);
            DataSet ds = mydb.db_GetddlDistris(strXML);
            return ds;
        }
        private DataSet bs_GetUserLoginSess(string strXML)
        {
            db_user mydb = new db_user(mcon);
            DataSet ds = mydb.db_GetUserLoginSess(strXML);
            return ds;
        }
        
        #endregion
    }
}
